*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #060b1a;
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 30%, rgba(99, 40, 220, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 70%, rgba(6, 182, 212, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 60% 10%, rgba(139, 92, 246, 0.2) 0%, transparent 50%),
    linear-gradient(160deg, #070c1f 0%, #0d1435 50%, #060e1c 100%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  min-height: 100vh;
}

.page-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Glass card — Apple liquid glass */
.card {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 1px 1px 8px 0 rgba(255, 255, 255, 0.2),
    inset -1px -1px 8px 0 rgba(255, 255, 255, 0.06),
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  transition: transform 0.15s ease;
}

/* top specular highlight */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.65) 35%,
    rgba(255, 255, 255, 0.65) 65%,
    transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* inner light refraction */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 50%,
    rgba(139, 92, 246, 0.04) 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* content above overlay */
.card > * {
  position: relative;
  z-index: 2;
}

#main.card {
  padding: 0;
  overflow: hidden;
  border-radius: 24px;
}

#main.card > * {
  z-index: 2;
}

.login-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
}

.card.portal-card {
  max-width: 460px;
  will-change: transform;
}

.login-site-title {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 16px rgba(139, 92, 246, 0.4);
}

.login-wrapper .card {
  max-width: 100%;
  width: 100%;
}

/* Login */
.title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.9);
}

#main input[type="text"],
#main input[type="password"] {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

#main input[type="text"]::placeholder,
#main input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#main input[type="text"]:focus,
#main input[type="password"]:focus {
  border-color: rgba(139, 92, 246, 0.7);
  background: rgba(255, 255, 255, 0.1);
}

#main button[type="submit"] {
  display: block;
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #7c3aed 0%, #0ea5e9 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s, transform 0.1s;
  font-weight: 500;
  letter-spacing: 0.02em;
}

#main button[type="submit"]:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.error {
  color: #f87171;
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.btn-switch {
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 14px;
  transition: background 0.15s;
}

.btn-switch:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* Login tabs */
.login-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 40px;
  flex-shrink: 0;
}

.login-tab {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.login-tab.active {
  color: rgba(255, 255, 255, 0.92);
  border-bottom-color: #8b5cf6;
  font-weight: 600;
}

.login-tab:hover:not(.active) {
  color: rgba(255, 255, 255, 0.65);
}

.login-panel {
  height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 40px;
  overflow: hidden;
}

.login-panels {
  height: 300px;
  overflow: hidden;
}

#show_load {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
  font-size: 14px;
}

.login-panel form {
  width: 100%;
}

/* QR code iframe: scale down proportionally, no scrollbars */
.qr-frame-wrapper {
  width: 265px;
  height: 300px;
  overflow: hidden;
}

.qr-frame-wrapper iframe {
  width: 340px;
  height: 460px;
  border: none;
  transform: scale(0.78);
  transform-origin: top left;
}

/* Portal */
.portal-header {
  margin-bottom: 20px;
}

.portal-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
}

.portal-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 5px;
  letter-spacing: 0.01em;
}

.portal-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 8px;
}

.divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 20px 0;
}

.link-list {
  list-style: none;
}

.link-list li a {
  display: flex;
  align-items: center;
  padding: 11px 0 11px 14px;
  border-left: 2px solid transparent;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, padding-left 0.15s;
}

.link-list li a:hover {
  border-left-color: #8b5cf6;
  color: #a78bfa;
  padding-left: 18px;
}

.action-list {
  list-style: none;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.action-list li a {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: color 0.15s;
}

.action-list li a:hover {
  color: rgba(255, 255, 255, 0.8);
}

#cli_token_box {
  margin-top: 14px;
}

#cli_token_value {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
  font-family: monospace;
}

.token-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 4px;
}
